package org.github.manx98.jlibhac.hle;

import lombok.Data;
import org.github.manx98.jlibhac.common.math.Uint64;
import org.github.manx98.jlibhac.fs.IStorage;

import java.io.IOException;

/**
 * @author Manx98
 * @version 1.0
 * @since 2022/10/6 0:01
 */
@Data
public class FsAccessHeader {
    public int   Version;
    public Uint64 PermissionsBitmask;
    public FsAccessHeader(IStorage stream, int offset, int size) throws IOException {
        stream.setPosition(offset);
        Version            = stream.readInt();
        PermissionsBitmask = stream.readUint64();

        int dataSize = stream.readInt();

        if (dataSize != 0x1c)
        {
            throw new IllegalArgumentException("FsAccessHeader is corrupted!");
        }

        int contentOwnerIdSize        = stream.readInt();
        int dataAndContentOwnerIdSize = stream.readInt();

        if (dataAndContentOwnerIdSize != 0x1c)
        {
            throw new IllegalArgumentException("ContentOwnerId section is not implemented!");
        }
    }
}
